IF(WIN32)
	SET(MAYA_REGISTRY_KEY 
		"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Autodesk\\Maya\\2009\\Setup\\InstallPath;MAYA_INSTALL_LOCATION]"
		"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Autodesk\\Maya\\2008\\Setup\\InstallPath;MAYA_INSTALL_LOCATION]"
		"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Autodesk\\Maya\\2010\\Setup\\InstallPath;MAYA_INSTALL_LOCATION]"
		)
	FIND_PATH(MAYA_ROOT_DIR NAMES include/maya/MFnPlugin.h PATHS ${MAYA_REGISTRY_KEY})
ENDIF()
#ELSE()
#	MESSAGE(FATAL_ERROR "Maya API is not found. Please check is everything installed properly.")
#ENDIF()

SET(MAYA_INCLUDE_DIR "${MAYA_ROOT_DIR}/include")
FIND_LIBRARY(OPEN_MAYA_LIBRARY NAMES OpenMaya PATHS ${MAYA_ROOT_DIR}/lib)
FIND_LIBRARY(OPEN_MAYA_ANIM_LIBRARY NAMES OpenMayaAnim PATHS ${MAYA_ROOT_DIR}/lib)
FIND_LIBRARY(MAYA_FOUNDATION_LIBRARY NAMES Foundation PATHS ${MAYA_ROOT_DIR}/lib)
IF(OPEN_MAYA_LIBRARY AND MAYA_FOUNDATION_LIBRARY AND OPEN_MAYA_ANIM_LIBRARY)
	SET(MAYA_LIBRARIES ${MAYA_FOUNDATION_LIBRARY} ${OPEN_MAYA_LIBRARY} ${OPEN_MAYA_ANIM_LIBRARY})
ENDIF()

INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(MAYA DEFAULT_MSG MAYA_INCLUDE_DIR MAYA_LIBRARIES)

MARK_AS_ADVANCED(MAYA_INCLUDE_DIR MAYA_LIBRARIES)

